<?php
	class connsql
	{
		var $dbconn;
		var $conninfo=array(
							'host'=>'null',
							'user'=>'null',
							'pass'=>'null',
							'dbname'=>'null'
							);
							
		function mydb($host,$user,$pass,$dbname)	//set connect sql's rule
		{
			$this->dbconn=@mysql_connect($host,$user,$pass) or die("无法连接数据库!");	//connect sql;
			@mysql_query("set names 'utf8'");	//set utf8
			@mysql_select_db($dbname,$this->dbconn);
		}
		
		function getrow($sql)	//get one rs;
		{
			$result=@mysql_query($sql,$this->dbconn) or die("查询语句".$sql."错误!"); 
			$result_1=@mysql_fetch_array($result); 
			return $result_1;  
		}
		
		function getarray($sql)	//get all rs;
		{
			$result=@mysql_query($sql,$this->dbconn) or die("查询语句".$sql."错误!");
			$result_array="";
			$i=0;
			while ($temp=@mysql_fetch_array($result)) 
			{
				$result_array[$i]=$temp;
				$i++;
			}
			return $result_array;
		}
		
		function command($sql)	//command sql
		{
			$result=@mysql_query($sql,$this->dbconn);
		}
		
		function close()	//close db
		{
			mysql_close($this->dbconn);
		}
	}
?>